<%--
  Created by IntelliJ IDEA.
  User: hqqs
  Date: 2020/10/11
  Time: 8:20 上午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="/manageHtml/admin_menu.jsp"%>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="../manageHtml/admin_index.jsp">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">分类管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action=<%=request.getContextPath()%>"/manageHtml/admin_doUserShow" method="get">
                    <table class="search-tab">
                        <tr>

                            <th width="70">关键字:</th>
                            <td><input class="common-text" placeholder="关键字" name="keywords" value="${param.keywords}" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form action=<%=request.getContextPath()%>"/manageHtml/admin_doUserDelete" id="myform" method="post">

                <div class="result-title">
                    <div class="result-list">
                        <a href="/manageHtml/admin_ToCateAdd"><i class="icon-font"></i>新增分类</a>
                        <a id="updateOrd" href="javascript:void(0)"><i class="icon-font"></i>更新排序</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="60%">
                        <tr>

                            <th>ID</th>
                            <th>分类名称</th>
                            <th>操作</th>
                        </tr>

                        <c:forEach var="cate" items="${catelist}">
                            <%--父分类--%>
                            <c:if test="${cate.CATE_PARENT_ID == 0}">
                                <tr>
                                    <td>${cate.CATE_ID}</td>
                                    <td>${cate.CATE_NAME}</td>
                                    <td><a href="/manageHtml/admin_toCateModify?id=${cate.CATE_ID}" >修改    </a>

                                </tr>
                            </c:if>
                                <%--子分类--%>
                            <c:forEach var="soncate" items="${catelist}">
                                <c:if test="${soncate.CATE_PARENT_ID == cate.CATE_ID}">
                                        <tr>
                                            <td>${soncate.CATE_ID}</td>
                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-${soncate.CATE_NAME}</td>
                                            <td><a href="/manageHtml/admin_toCateModify?id=${soncate.CATE_ID}" >修改    </a><a href="javascript:delCate(${soncate.CATE_ID})" >删除</a></td>
                                        </tr>

                                </c:if>
                            </c:forEach>



                        </c:forEach>

                        <script>

                            function delCate(id){
                                if (confirm("你确定删除该分类？")) {//用于删除弹窗的返回
                                    location.href = "/manageHtml/admin_doCateDelete?id="+id;
                                }
                            }
                        </script>

                    </table>
                    <div class="list-page">
                        <a href="manageHtml/admin_doUserShow?cp=1${searchParams}">首页</a>
                        <a href="manageHtml/admin_doUserShow?cp=${cpage-1 <= 0?1:cpage-1}${searchParams}">上一页</a>
                        共${tsum}条记录，当前${cpage}/${pagenum}页
                        <a href="manageHtml/admin_doUserShow?cp=${cpage+1 >=pagenum?pagenum:cpage+1}${searchParams}">下一页</a>
                        <a href="manageHtml/admin_doUserShow?cp=${pagenum}${searchParams}">尾页</a>


                    </div>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
</div>
</body>
</html>
